const Sequelize = require('sequelize')

const {
    dbName,
    host,
    port,
    user,
    password
} = require('../config').database
const sequelize = new Sequelize(dbName, user, password, {
    host,
    port,
    dialect: 'mysql',
    logging: false,
    timezone: '+08:00',
    define: {
        timestamps: true,
        createdAt: 'created_at',
        updatedAt: 'updated_at',
        deletedAt: false,
        underscored: true,
        freezeTableName: true
    },
    pool: {
        max: 5000,
        min: 0,
        idle: 10000
    },
})

sequelize.sync({
    force: false
})

module.exports = sequelize